MAKESUBDIR 	:= config.subdir

include ./$(MAKESUBDIR)

#include ./config.local
TARGETDIR = target
TARGETDIR_LIB = $(TARGETDIR)/lib
TARGETDIR_BIN = $(TARGETDIR)/bin

all:
	mkdir -p target 
	mkdir -p target/lib
	mkdir -p target/bin
	@list='$(SUBDIRS)'; for subdir in $$list; do \
                (cd $$subdir && make all); \
		if [ $$? -ne 0 ]; then \
			echo "Building $$subdir is failed !"; \
			exit $$?; \
		fi; \
	done;


#mkdir target 
#mkdir target/lib
#mkdir target/bin
#$(TARGETDIR):
#	if [ ! -d "./$(TARGETDIR)" ];then 
#		mkdir $(TARGETDIR)
#		echo $(TARGETDIR)
#	fi	
	#$(TARGETDIR)


.PHONY: clean
clean:
	@list='$(SUBDIRS)'; for subdir in $$list; do \
                echo "Clean in $$subdir"; \
                (cd $$subdir && make clean); \
	done
	rm target -rf

